<?php
namespace Admin\Models\user;

use Phalcon\Di;
use Phalcon\Db\Adapter\Pdo\Mysql;
use Admin\Models\BaseModel;
use Helpers\Main;

class XhsysAllowrepeatlogon extends BaseModel
{

    /**
     *
     * @var integer
     * @Primary
     * @Identity
     * @Column(type="integer", length=20, nullable=false)
     */
    public $iARLUserId;

    /**
     *
     * @var string
     * @Column(type="string", length=30, nullable=true)
     */
    public $sARLLogonName;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $iSchoolId;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tDeadline;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $bEnable;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $bDelete;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tCreateDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=20, nullable=true)
     */
    public $iCreateUserId;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tLastModifyDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=20, nullable=true)
     */
    public $iLastModifyUserId;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        parent::initialize();
//        $service = 'oldCenterDB';
//        if(!Di::getDefault()->has($service)){
//            $dbConfig = Main::getConfigByName($service);
//            Di::getDefault()->setShared($service, function() use ($dbConfig){
//                return new Mysql($dbConfig);
//            });
//        }
//        $this->setConnectionService($service);
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'XHSys_AllowRepeatLogon';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return XhsysAllowrepeatlogon[]|XhsysAllowrepeatlogon
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return XhsysAllowrepeatlogon
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

}
